<h1>New consultation</h1>

<%= error_messages_for :consultation %>

<% form_for(:consultation, :url => consultations_path) do |f| %>
  <p>
    <b>Code</b><br />
    <%= f.text_field :code %>
  </p>

  <b>Condition</b><br />
	<%= @conditions=Condition.find(:all,:order=>"name")
		f.collection_select(:condition_id,@conditions,:id,:name)
	%>

  <p>
    <b>Month</b><br />
	Offset from Month 1 (1-12)
    <%= f.text_field :month %>
  </p>
	<% for item in @items %>
	<input type="checkbox"
			id="<%=item.id%>"
			name="item_ids[]"
			value="<%=item.id%>"
			<% if @consultation.item_numbers.include? item%>checked="checked"<%end%>
			>  <%=item.name%>(<%= item.number %>)
	<% end %>
  <p>

  <p>
    <%= submit_tag "Create" %>
  </p>
<% end %>

<%= link_to 'Back', consultations_path %>